Skip to main content

All Questions

Tagged with
2votes
1answer
60views

Merge Sort with Minimum Sufficient Variables, Verbosity and better Space Complexity

The majority of merge sort implementations searched online are provided with unnecessary variables and code lines. Here is an attempt to reduce that. However, does passing back the subArray as return ...
Thomas Mathew's user avatar
4votes
1answer
358views

recursive bin packing

For the company I work for we spec lengths of tube of varying lengths. For a given project let's say there is a list like this 100', 115', 105', 205', 195', 240', 240', 130', 180', 140', 225', 85' ...
Nick's user avatar
6votes
2answers
446views

Selection Sort Algorithm (Node.js)

I wanted to implement a selection sort and wanted to make sure that I'm doing it correctly. I wanted to do it in a way that's efficient and use recursion. Please let me know if I am doing this ...
Christopher Chen's user avatar
1vote
1answer
4kviews

The quicksort algorithm in Haskell

I am learning Haskell programming language mainly from this source. And there I have encouraged with "an elegant" realization of the quicksort sorting algorithm (the Quick, sort! section). ...
LRDPRDX's user avatar
2votes
1answer
100views

Most efficient way to find spatial order from a list of tuples (Python)

I have a circle-growth algorithm (line-growth with closed links) where new points are added between existing points at each iteration. The linkage information of each point is stored as a tuple in a ...
solub's user avatar
3votes
2answers
2kviews

Insert a number in a sorted list and return the list with the number at the correct index

I feel like the title is a bit wordy. What I have defined here is a function that takes two parameters: a list that contains valued sorted from smallest to biggest a number to insert at the right ...
Mister Tusk's user avatar
3votes
2answers
384views

Check whether array is sorted recursively

I'm trying to implement isSorted method checking whether given array is sorted recursively. I've written two types, one is similar to merge sort logic, the another ...
Soner from The Ottoman Empire's user avatar
1vote
1answer
1kviews

Recursive quicksort in Python

I want to find a more elegant way to build a recursive sorting function. The function randomly selects one of the numbers from a given list, k, and splits the list ...
user avatar
2votes
2answers
506views

Recursive and Non-recursive SelectionSort

This is a naive attempt of writing a recursive and non-recursive versions for SelectionSort(). My goal is mainly to present an elegant, easy-to-understand, ...
lifebalance's user avatar
1vote
1answer
126views

Large switch statement bucketing system

I've finally got a solution for a "weekly streak" bucketing system I've been working on but unfortunately it's resulted in a very large switch statement. I'm running through a handful of dates and ...
Rudest Buddhist's user avatar
3votes
1answer
3kviews

A recursive sort and filter for a nested object

I have a nested object which I need to filter and sort. I have a nested Object where some keys like app1 are nested inside another object. I need to be able to filter out objects with the status of ...
Rick's user avatar
  • 586
4votes
1answer
2kviews

CLRS Exercise 2.3-4: Recursive Insertion Sort

I'm going through CLRS 3e and executing exercises to obtain a better understanding of CS fundamentals. Below is my solution to the following exercise from chapter 2: We can express insertion sort ...
openingceremony's user avatar
2votes
0answers
373views

Follow-up 1: Compare 2 unordered, rooted trees for shape-isomorphism

The previous post can be found here. In the previous post I tried to solve an exercise but found through the answer of Peilonrayz a bug in the code and 2 more while fixing it. These have now been ...
Philipp Doerner's user avatar
2votes
2answers
1kviews

Compare 2 unordered, rooted trees for shape-isomorphism

I'm currently working through "Algorithms in java" by Robert Sedgewick (3rd edition, german version) on my own and am trying to solve one of the exercises there. Edit: This question now also has a ...
Philipp Doerner's user avatar
5votes
4answers
5kviews

Recursive and iterative approach for mergesort

Problem: Question 8: * Mergesort is a type of sorting algorithm. It follows a naturally recursive procedure: Break the input list into equally-sized halves Recursively sort both ...
overexchange's user avatar

153050per page
close